Euler Problem 3

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?


In [3]:
N = 600851475143
for k in range(2, N):
    while N > k and N % k == 0:
        N //= k
    if N < k*k:
        break
print(N)


6857

In [ ]: